import axios from "axios";
axios.defaults.baseURL = "http://open.duyiedu.com";
axios.interceptors.request.use(
  function(config) {
    config.params = {
      ...config.params,
      appkey: "squarecun_1615415122672"
    };
    return config;
  },
  function() {
    console.log("请求出错");
  }
);
let api = {
  getSearchList(params) {
    return axios.get("/api/meituan/header/search.json", params);
  },
  getMenuList(params) {
    return axios.get("/api/meituan/index/nav.json", params);
  },
  getResultProducts(params) {
    return axios.get("/api/meituan/index/resultsByKeywords.json", params);
  },
  getProductsList(params) {
    return axios.get("/api/meituan/list/goodsList.json", params);
  },
  getHotCity(params) {
    return axios.get("/api/meituan/city/hot.json", params);
  },
  getRecents(params) {
    return axios.get("/api/meituan/city/recents.json", params);
  },
  getProvince(params) {
    return axios.get("/api/meituan/city/province.json", params);
  },
  getPosition(params) {
    return axios.get("/api/meituan/city/getPosition.json", params);
  },
  getCityList(params) {
    return axios.get("/api/meituan/city/cityList.json", params);
  },
  login(params) {
    return axios.get("/api/meituan/login.json", params);
  }
};
export default api;
